import os
import platform

LIB_DIR=os.environ['LIB_DIR'];
BIN_DIR=os.environ['BIN_DIR'];

SOURCES = [
  'sqlite3.c',
]

env=DefaultEnvironment().Clone()

EXPORT_DEF=''
OS_NAME = platform.system();
if OS_NAME == 'Windows':
  EXPORT_DEF = ' -DSQLITE_API="__declspec(dllexport)" '

if 'BUILD_SHARED' in os.environ and os.environ['BUILD_SHARED'] == 'True':
  LIBS=['awtk'];
  CCFLAGS=env['CCFLAGS'] + EXPORT_DEF 
  env.SharedLibrary(os.path.join(BIN_DIR, 'sqlite3'), SOURCES, LIBS=LIBS, CCFLAGS=CCFLAGS);
else:
  env.Library(os.path.join(LIB_DIR, 'sqlite3'), SOURCES);

